home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 3 / Cream of the Crop 3.iso / diag / see270.zip / SEEMEM.DOC < prev    next >
Text File  |  1994-02-23  |  15KB  |  294 lines

  1.  
  2.  
  3.  
  4.                                    SEEMEM.EXE 
  5.                                   Version 2.70
  6.                                  February, 1994
  7.  
  8.  
  9.  
  10.         Author:   Tedrick A. Housh, Jr.
  11.                   5811 West 85th Terrace
  12.                   Overland Park, KS 66207
  13.  
  14.  
  15.  
  16.         Electronic Mail: CompuServe 72466,212
  17.                          Genie      R.HOUSH 
  18.  
  19.  
  20.  
  21.         The objective of SEEMEM is to display information about the
  22.         current use of MS-DOS memory by the operating system, and
  23.         resident processes and data.
  24.  
  25.         It is designed to make full use of the new memory facilities
  26.         provided by DOS version 6.20, and to provide information similar
  27.         to that provided by the DOS utility MEM.  However, it provides
  28.         this information even when DOS does not control Upper or Extended
  29.         memory, and even when HIMEM.SYS and EMM386.EXE are not loaded,
  30.         and recognizes UMB's created by other programs, such as
  31.         Quarterdeck Software's QEMM386 (for 386 and higher) and QRAM (for
  32.         286 cpu's with EMS version 4.00 hardware or Chips and
  33.         Technologies Shadow Ram).  It works with these programs on all
  34.         versions of DOS greater than 1, and on all CPU chips, 8088 and
  35.         higher, although the memory detail displayed increases with
  36.         increase in CPU version.  As of SeeMem version 2.00, it provides
  37.         full support for DR-DOS 6.00 also, and with version 2.65 for
  38.         Qualitas' 386Max, and Helix Software's NetRoom. 
  39.  
  40.         SEEMEM was written in Turbo Pascal 7.00, as an exercise in the
  41.         use of the Built-In Assembler (BASM).  In that connection, all
  42.         necessary DOS functions were specifically coded in BASM, as were
  43.         all functions which necessarily interface with the extended
  44.         memory (XMS) driver provided by HIMEM.SYS, or its counterparts
  45.         such as QEMM386.SYS, or QEXT.SYS, or EMM386.SYS. This completely
  46.         eliminates the need for the Turbo Pascal DOS unit, or a unit to
  47.         interface with the XMS and UMB device drivers. All the low level
  48.         functions necessary for this purpose are included directly in the
  49.         SEEMEM.PAS file as BASM code, and the .PAS file is independent
  50.         and completely self-supporting. 
  51.  
  52.         The display output for SEEMEM is in three parts.  The first part,
  53.         which may include several screen pages, displays every memory
  54.         control block (MCB) between Segment 0 and the top of conventional
  55.         memory (Segment 9FFFh on a 640k machine), and also between the
  56.         top of conventional memory and the start of the High Memory Area
  57.  
  58.                                         1
  59.  
  60.  
  61.         (HMA) if any, or the top of Upper Memory (Segment 0FFFFh).  For
  62.         each MCB SEEMEM displays its segment address (in hex), its size
  63.         (in  bytes), the segment of its "owner," its "parent" (i.e. the
  64.         MCB of the program that loaded it), its type (e.g. TSR or
  65.         Environment), and its name (if determinable). 
  66.  
  67.         The second part is a display of EMS (Expanded Memory) if
  68.         applicable.  This displays the version number of the EMS device
  69.         driver, the page frame segment, the total size of the installed
  70.         EMS memory, the number of mapping register sets available,
  71.         whether or not nonvolatile handles (will survive warm boot) are
  72.         available, the number of DMA channels , the maximum number of EMS
  73.         handles supported, the number of free handles, free pages, page
  74.         size, and free memory, and for each handle in use, the handle
  75.         number, the number of EMS pages, the page size, the memory used,
  76.         and if available, the handle name.  This second part may occupy
  77.         more than one screen page. 
  78.  
  79.         The third part displays XMS information (if a driver is
  80.         installed), including XMS version number, revision number, the
  81.         XMM Control Vector in segment:offset form, total XMS free memory,
  82.         and largest free XMS block.  With respect to the High Memory Area
  83.         (HMA) SEEMEM shows whether the A20 line is currently enabled,
  84.         whether HMA is implemented, whether the HMA is available for use.
  85.         If the DOS version is 5.00 or greater SEEMEM also will say
  86.         whether DOS is resident in the HMA (DOS=HIGH in config.sys), and,
  87.         if so, how much of the HMA DOS has left available for additional
  88.         buffers, etc.  SEEMEM also displays the location of DOS when it
  89.         is located elsewhere (i.e. ROM or Conventional memory). 
  90.  
  91.         The third part also displays information about Upper Memory
  92.         Blocks (UMB's) if available:  whether UMB's are implemented,
  93.         whether they are controlled by device driver or by DOS itself
  94.         (with DOS 5.00 and higher), whether UMB's are linked to
  95.         conventional memory (DOS 5.00) or are independent, and whether
  96.         UMB's are implemented by DOS=UMB in CONFIG.SYS (DOS 5.00). 
  97.  
  98.         Seemem does NOT display device driver information loaded under
  99.         DOS version 4.xx or higher's "secondary" MCB's, although it will
  100.         display such primary MCB's other software may use to load such
  101.         device driver's "high" in UMB's if each is given its own MCB.
  102.         This was a design decision to avoid "clutter."  Plenty of
  103.         programs are available to "walk" the device chain and display
  104.         this information. 
  105.  
  106.         A word about resident code names is in order. Under DOS 2.xx the
  107.         name of resident loading programs is not determinable.  With DOS
  108.         3.xx the name may be determined from the environment, unless that
  109.         was released back to DOS's pool on installation.  With DOS 4.xx
  110.         and higher an eight character name is inserted in the last eight
  111.         bytes of the 16 byte MCB, and therefore is always available. Some
  112.         other programs which control UMB's insert the eight character
  113.         name in the MCB under any DOS version, but this is not used by
  114.         SEEMEM.  SEEMEM uses the most detailed information available
  115.  
  116.  
  117.                                         2
  118.  
  119.  
  120.         through DOS.  Therefore, if the DOS version is 4 or higher, and
  121.         the environment pertaining to the process is still resident, the
  122.         program name and extension is taken from the environment
  123.         (although the drive and directory information is stripped from
  124.         the filename before display). 
  125.  
  126.         A full explanation of the XMS, UMB, and HMA standards is not
  127.         within the scope of this documentation, however an understanding
  128.         of a few of the more obscure facts will help understand SEEMEM's
  129.         operation.   The "XMS Specification" for extended memory is
  130.         similar to the EMS spec for expanded memory.  It provides
  131.         functions for implementing use of extended memory with handles in
  132.         a manner very much the same as EMS does for expanded memory.  The
  133.         High Memory Area (HMA) is the 64 kilobyte (less 16 bytes) just
  134.         above the 1 megabyte limit of the 8086 and 8088 chips. Obviously,
  135.         then XMS extended memory and the HMA require a 80286 chip or
  136.         higher.  However, through a clever addressing scheme, and an
  137.         additional hardware address line, an 80286 or higher can address
  138.         the HMA in "real" mode, i.e. as "non-extended" memory. Although
  139.         XMS drivers existed before DOS 5.00, and some alternative
  140.         DOS-like operating systems allowed the use of this space for some
  141.         things, DOS 5.00 now allows DOS itself to be loaded there,
  142.         substantially increasing the possible useable memory space in
  143.         lower memory previously used by DOS. 
  144.  
  145.         Although the protocols and specifications for Upper Memory Blocks
  146.         (UMB's) are contained in the original XMS specifications, they
  147.         are NOT necessarily part of the XMS driver itself, and in fact
  148.         were not implemented by the first MicroSoft driver, HIMEM.SYS.
  149.         The XMS specification only provides one control vector however,
  150.         so if all UMB calls need be implemented through that vector, a
  151.         UMB driver must be integrated with the XMS driver, or must hook
  152.         that vector (necessarily implying that it must be loaded after
  153.         the XMS driver has installed the vector) unless it is completely
  154.         integrated.  However DOS 5.00 has supplied interrupt 21h function
  155.         calls to manipulate the use of existing UMB's for detecting the
  156.         existence, state and governing the rules of use of UMB's, and
  157.         these function calls are not dependent on the existence of any
  158.         device driver, nor for that matter, the existence of any extended
  159.         memory, or a chip higher than that 8088-8086.  The thought may
  160.         take some getting used to, but this means that UMB's can exist
  161.         without any driver or control vector at all.  In fact there is at
  162.         least one program available which acts as though it were a device
  163.         driver, creates UMB's from the shadow ram available through some
  164.         motherboard chipset implementations, hands it over to DOS, and
  165.         then just aborts, itself disappearing from memory.  DOS then
  166.         owns, and makes available some UMB's with no device driver to
  167.         control them.  SEEMEM can also detect this type of UMB and
  168.         display its state. 
  169.  
  170.         DOS 5.00 provides greatly increased support for XMS, HMA, and
  171.         UMB's, and SEEMEM uses all of it, where it is possible to do so.
  172.  
  173.         In order that it may support full display redirection SEEMEM does
  174.         not do any direct video memory-mapped display.  All display is
  175.         through DOS or BIOS.  Each screen is paged with a "MORE" line at
  176.  
  177.                                         3
  178.  
  179.  
  180.         the bottom UNLESS the /N ("NO PAUSE") switch is used.  Another
  181.         switch available is the help /H or /? switch, which displays a
  182.         simple help message.  The output may be directed to a file or a
  183.         device such as a printer, in which case you will probably wish to
  184.         bypass paging also, with the /n switch.  As of SeeMem version
  185.         2.00 SeeMem detects this redirection and turns paging off by
  186.         itself.
  187.  
  188.         For example SEEMEM /N > PRN  would send the output of the program
  189.         to the printer for a permanent record.  In order to speed the
  190.         output slightly the DOS IOCTL function is used to switch to "raw"
  191.         output mode, and is returned to its prior state, probably
  192.         "cooked," upon program termination.  This speeds up output by
  193.         eliminating checks for ^S, ^Q, ^C and expansion of tabs, etc., so
  194.         you cannot manually pause the program or "break" it.  No tabs or
  195.         other characters requiring interpretation are used however, so
  196.         you should see no difference due to disallowance of "cooked"
  197.         mode. 
  198.  
  199.         If you insist on a "scrollable" output I have successfully used
  200.         the J.P. Software's 4DOS command shell internal LIST command with
  201.         SEEMEM to provide this with the following command line: 
  202.  
  203.         SEEMEM /N | LIST /S 
  204.  
  205.         This provides an output which uses LIST to scroll from top to
  206.         bottom. 
  207.  
  208.         I have made the source code available in Turbo Pascal 7.0 on the
  209.         Borland Support area on GEnie and in the Borland Programming Area
  210.         on CompuServe.  The program is copyright but donated to the
  211.         public domain without any restriction, except that it be
  212.         distributed in its original form with appropriate authorship
  213.         credit, with no charge other than reasonable fees for duplication
  214.         and distribution, including by electronic means.  It is
  215.         specifically intended and permission is granted for distribution
  216.         by commercial electronic sources for their regular and customary
  217.         access and membership fees even though they may be operated for
  218.         profit.  No warranties of any kind accompany SEEMEM, and the
  219.         author assumes no responsibility for any consequences of its use,
  220.         either direct or consequential.
  221.  
  222.         The basic idea for SEEMEM is not new, of course and all parts of
  223.         it borrow heavily upon prior, similar programs.  Perhaps it
  224.         should be named YAMEM (Yet Another MEMory display program).
  225.         Nevertheless it does do some things no other does (that I know
  226.         of) and it is a demonstration of Turbo Pascal's BASM facility
  227.         which clearly shows the practicality of the TP environment for
  228.         low level system programming.  In fact, I don't think the same
  229.         thing could be done in C with faster or smaller code resulting.
  230.         Yeah, I know, TP is primarily a shell for the assembly stuff, but
  231.         at least it can do that now, and very adroitly, too.
  232.  
  233.  
  234.                                         4
  235.  
  236.                                New in Version 2.70
  237.  
  238.         Since version 2.6, a number of fixes have been made, support for
  239.         MS-DOS 6.xx, DR-DOS 6.00, and 4DOS 5.xx has been expanded
  240.         considerably.  In addition adjustments have been made for Windows
  241.         3.10 enhanced mode.
  242.  
  243.         Most of the fixes were necessary because arithmetic has never
  244.         been my forte' and calculations of block sizes, etc. were not
  245.         quite accurate enough.  Most user's apparently didn't notice but
  246.         a few did call my attention to this, for which I thank them.
  247.  
  248.         Two switches were added, /L for "Long" which sets the page length
  249.         in each section of the report to 55 lines so that redirection to
  250.         the printer will look better, and /C which allows displays of
  251.         control and "high order" characters which are ordinarily
  252.         automatically converted to something any printer can handle. 
  253.         SEEMEM now automatically detects redirection and turns off
  254.         pausing when the output is redirected to anything but the
  255.         standard output (normally the screen).
  256.  
  257.         The owner names were changed somewhat.  Most are self explanatory
  258.         to those who need the information.  "TSR" represents a resident
  259.         program (if it's resident it's really a "process").
  260.  
  261.         Support has been added for Quarterdeck's QEMM and QRAM, Qualitas'
  262.         386Max, and Helix's NetRoom.  Varying degrees of detail are
  263.         gleaned from these memory managers.  Staying as generic as
  264.         possible requires some compromises.
  265.  
  266.         There were a number of other technical changes since version 2.00
  267.         which are mentioned in SEEMEM's history file SEEMEM.HST, which
  268.         accompanies this documentation.
  269.  
  270.         Source code (Turbo Pascal 7.0) is available by sending a blank,
  271.         formatted disk and appropriately sized SASE to the above address,
  272.         or may be downloaded from the Borland Turbo Pascal Forum on
  273.         CompuServe Information Service (search for keyword SEEMEM270).
  274.  
  275.         Enjoy,
  276.  
  277.                Rick Housh
  278.  
  279.  
  280.  
  281.  
  282.  
  283.  
  284.  
  285.  
  286.  
  287.  
  288.  
  289.  
  290.  
  291.  
  292.  
  293.                                         5
  294.